package com.panda.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.panda.entity.po.Video;
import com.panda.entity.vo.VideoVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

//import java.sql.Wrapper;
import java.util.List;
import java.util.Map;


/**
 * (Video)表数据库访问层
 *
 * @author makejava
 * @since 2022-05-13 15:07:53
 */
public interface VideoMapper extends BaseMapper<Video> {
    String querySQL = "select v.*,u.username from t_video as v left join t_user as u on v.create_by= u.id";
    String wrapperSQL = "SELECT * from ( " + querySQL + " ) AS q ${ew.customSqlSegment}";


    List<Map<String,String>> createdVideoStatistic();

    List<Map<String,String>> categoryStatistic();

    List<Map<String,String>> createdCategoryOfWeek(@Param("categoryName") String categoryName);

    List<Map<String, String>> createdVideoOfCategory(@Param("categoryName") String categoryName);

    @Select(wrapperSQL)
    Page<VideoVo> selectVideoConnectName(Page page, @Param("ew") Wrapper queryWrapper);

    List<Map<String,String>> hotVideos(@Param("topic") String topic);
}

